

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

    <title>saml2.errors &mdash;  SAML Python library classes and methods</title>

    <link rel="stylesheet" href="../../_static/default.css" type="text/css" />
    <link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />

    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '../../',
        VERSION:     '',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="../../_static/jquery.js"></script>
    <script type="text/javascript" src="../../_static/underscore.js"></script>
    <script type="text/javascript" src="../../_static/doctools.js"></script>
    <link rel="top" title=" SAML Python library classes and methods" href="../../index.html" />
    <link rel="up" title="Class code" href="../index.html" />
  </head>
  <body>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../../genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="../../py-modindex.html" title="Python Class Index"
             >modules</a> |</li>
        <li><a href="../../index.html"> SAML Python library classes and methods</a> &raquo;</li>
          <li><a href="../index.html" accesskey="U">Class code</a> &raquo;</li>
      </ul>
    </div>

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">

  <h1>Source code for saml2.errors</h1><div class="highlight"><pre>
<span class="c"># -*- coding: utf-8 -*-</span>


<div class="viewcode-block" id="OneLogin_Saml2_Error"><a class="viewcode-back" href="../../saml2.html#saml2.errors.OneLogin_Saml2_Error">[docs]</a><span class="k">class</span> <span class="nc">OneLogin_Saml2_Error</span><span class="p">(</span><span class="ne">Exception</span><span class="p">):</span>

    <span class="c"># Errors</span>
    <span class="n">SETTINGS_FILE_NOT_FOUND</span> <span class="o">=</span> <span class="mi">0</span>
    <span class="n">SETTINGS_INVALID_SYNTAX</span> <span class="o">=</span> <span class="mi">1</span>
    <span class="n">SETTINGS_INVALID</span> <span class="o">=</span> <span class="mi">2</span>
    <span class="n">METADATA_SP_INVALID</span> <span class="o">=</span> <span class="mi">3</span>
    <span class="n">SP_CERTS_NOT_FOUND</span> <span class="o">=</span> <span class="mi">4</span>
    <span class="n">REDIRECT_INVALID_URL</span> <span class="o">=</span> <span class="mi">5</span>
    <span class="n">PUBLIC_CERT_FILE_NOT_FOUND</span> <span class="o">=</span> <span class="mi">6</span>
    <span class="n">PRIVATE_KEY_FILE_NOT_FOUND</span> <span class="o">=</span> <span class="mi">7</span>
    <span class="n">SAML_RESPONSE_NOT_FOUND</span> <span class="o">=</span> <span class="mi">8</span>
    <span class="n">SAML_LOGOUTMESSAGE_NOT_FOUND</span> <span class="o">=</span> <span class="mi">9</span>
    <span class="n">SAML_LOGOUTREQUEST_INVALID</span> <span class="o">=</span> <span class="mi">10</span>
    <span class="n">SAML_LOGOUTRESPONSE_INVALID</span> <span class="o">=</span> <span class="mi">11</span>
    <span class="n">SAML_SINGLE_LOGOUT_NOT_SUPPORTED</span> <span class="o">=</span> <span class="mi">12</span>

    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">message</span><span class="p">,</span> <span class="n">code</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">        Initializes the Exception instance.</span>

<span class="sd">        Arguments are:</span>
<span class="sd">            * (str)   message.   Describes the error.</span>
<span class="sd">            * (int)   code.      The code error (defined in the error class).</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="kn">from</span> <span class="nn">saml2.utils</span> <span class="kn">import</span> <span class="n">_</span>

        <span class="k">assert</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">message</span><span class="p">,</span> <span class="nb">basestring</span><span class="p">)</span>
        <span class="k">assert</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">code</span><span class="p">,</span> <span class="nb">int</span><span class="p">)</span>

        <span class="k">if</span> <span class="n">errors</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
            <span class="n">message</span> <span class="o">=</span> <span class="n">message</span> <span class="o">%</span> <span class="n">errors</span>

        <span class="ne">Exception</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">_</span><span class="p">(</span><span class="n">message</span><span class="p">))</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">code</span> <span class="o">=</span> <span class="n">code</span></div>
</pre></div>

          </div>
        </div>
      </div>
      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
<div id="searchbox" style="display: none">
  <h3>Quick search</h3>
    <form class="search" action="../../search.html" method="get">
      <input type="text" name="q" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
    <p class="searchtip" style="font-size: 90%">
    Enter search terms or a module, class or function name.
    </p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../../genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="../../py-modindex.html" title="Python Class Index"
             >modules</a> |</li>
        <li><a href="../../index.html"> SAML Python library classes and methods</a> &raquo;</li>
          <li><a href="../index.html" >Class code</a> &raquo;</li>
      </ul>
    </div>
    <div class="footer">
      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.3.
    </div>
  </body>
</html>
